<template>
  <view class="page">
    <Header> </Header>
    <view class="main_container">
      <view class="main_content">
        <view class="content">
          <view class="progress">
            <u-circle-progress
              active-color="#3980ff"
              inactive-color="#dbedff"
              bg-color="rgba(0, 0, 0, 0)"
              border-width="20"
              :percent="gotScore"
              width="256"
            >
              <view class="progress_content">
                <view>{{ gotScore }}</view>
                <text>得分</text>
              </view>
            </u-circle-progress>
          </view>
          <view class="info">
            <view class="info_item">
              <view>{{ questionNumber }}</view>
              <text>试卷总题</text>
            </view>
            <view class="info_item">
              <view>
                {{ ((this.gotScore / this.score) * 100).toFixed(2) }}%
              </view>
              <text>正确率</text>
            </view>
            <view class="info_item">
              <view>{{ examDuration }}分钟</view>
              <text>练习耗时</text>
            </view>
          </view>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
import { getWordPaperResult } from "@/api/sync";
export default {
  components: {},
  data() {
    return {
      id: "",
      gotScore: 0,
      score: 0,
      questionNumber: 0,
      examDuration: 0,
    };
  },
  onLoad(options) {
    this.id = options.id;
    this.getData();
  },
  methods: {
    getData() {
      let params = {
        id: this.id,
      };
      getWordPaperResult(params).then((res) => {
        this.gotScore = res.data.gotScore;
        this.score = res.data.score;
        this.questionNumber = res.data.questionNumber;
        this.examDuration = res.data.examDuration;
      });
    },
  },
};
</script>

<style lang="scss" scoped>
@import "./examBookDetail";
</style>
